/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.pucp.sigepa.recocidosimulado.Modelo;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author carloslengua
 */
@Entity
@Table(name = "tipo_avion")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TipoAvion.findAll", query = "SELECT t FROM TipoAvion t"),
    @NamedQuery(name = "TipoAvion.findByIdtipo", query = "SELECT t FROM TipoAvion t WHERE t.idtipo = :idtipo"),
    @NamedQuery(name = "TipoAvion.findByDescripcion", query = "SELECT t FROM TipoAvion t WHERE t.descripcion = :descripcion"),
    @NamedQuery(name = "TipoAvion.findByVelmin", query = "SELECT t FROM TipoAvion t WHERE t.velmin = :velmin"),
    @NamedQuery(name = "TipoAvion.findByVelmax", query = "SELECT t FROM TipoAvion t WHERE t.velmax = :velmax"),
    @NamedQuery(name = "TipoAvion.findByDistmax", query = "SELECT t FROM TipoAvion t WHERE t.distmax = :distmax"),
    @NamedQuery(name = "TipoAvion.findByCappack", query = "SELECT t FROM TipoAvion t WHERE t.cappack = :cappack"),
    @NamedQuery(name = "TipoAvion.findByCostavion", query = "SELECT t FROM TipoAvion t WHERE t.costavion = :costavion"),
    @NamedQuery(name = "TipoAvion.findByFechareg", query = "SELECT t FROM TipoAvion t WHERE t.fechareg = :fechareg")})
public class TipoAvion implements Serializable {
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoAvion", fetch = FetchType.LAZY)
    private List<AvionSim> avionSimList;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idtipo")
    private Integer idtipo;
    @Column(name = "descripcion")
    private String descripcion;
    @Basic(optional = false)
    @Column(name = "velmin")
    private double velmin;
    @Basic(optional = false)
    @Column(name = "velmax")
    private double velmax;
    @Basic(optional = false)
    @Column(name = "distmax")
    private double distmax;
    @Basic(optional = false)
    @Column(name = "cappack")
    private int cappack;
    @Basic(optional = false)
    @Column(name = "costavion")
    private double costavion;
    @Basic(optional = false)
    @Column(name = "fechareg")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechareg;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoAvion", fetch = FetchType.LAZY)
    private List<Avion> avionList;

    public TipoAvion() {
    }

    public TipoAvion(Integer idtipo) {
        this.idtipo = idtipo;
    }

    public TipoAvion(Integer idtipo, double velmin, double velmax, double distmax, int cappack, double costavion, Date fechareg) {
        this.idtipo = idtipo;
        this.velmin = velmin;
        this.velmax = velmax;
        this.distmax = distmax;
        this.cappack = cappack;
        this.costavion = costavion;
        this.fechareg = fechareg;
    }

    public Integer getIdtipo() {
        return idtipo;
    }

    public void setIdtipo(Integer idtipo) {
        this.idtipo = idtipo;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public double getVelmin() {
        return velmin;
    }

    public void setVelmin(double velmin) {
        this.velmin = velmin;
    }

    public double getVelmax() {
        return velmax;
    }

    public void setVelmax(double velmax) {
        this.velmax = velmax;
    }

    public double getDistmax() {
        return distmax;
    }

    public void setDistmax(double distmax) {
        this.distmax = distmax;
    }

    public int getCappack() {
        return cappack;
    }

    public void setCappack(int cappack) {
        this.cappack = cappack;
    }

    public double getCostavion() {
        return costavion;
    }

    public void setCostavion(double costavion) {
        this.costavion = costavion;
    }

    public Date getFechareg() {
        return fechareg;
    }

    public void setFechareg(Date fechareg) {
        this.fechareg = fechareg;
    }

    @XmlTransient
    public List<Avion> getAvionList() {
        return avionList;
    }

    public void setAvionList(List<Avion> avionList) {
        this.avionList = avionList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idtipo != null ? idtipo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoAvion)) {
            return false;
        }
        TipoAvion other = (TipoAvion) object;
        if ((this.idtipo == null && other.idtipo != null) || (this.idtipo != null && !this.idtipo.equals(other.idtipo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.pucp.sigepa.recocidosimulado.Modelo.TipoAvion[ idtipo=" + idtipo + " ]";
    }

    @XmlTransient
    public List<AvionSim> getAvionSimList() {
        return avionSimList;
    }

    public void setAvionSimList(List<AvionSim> avionSimList) {
        this.avionSimList = avionSimList;
    }
    
}
